# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=yubikey-touch-detector
pkgver=1.10.1
pkgrel=6
pkgdesc="Tool to detect when your YubiKey is waiting for a touch"
url="https://github.com/maximbaz/yubikey-touch-detector"
arch="all !armhf !armv7 !x86"  # fails to build
license="ISC"
makedepends="go"
# Note: SVG image is based on https://github.com/Yubico/yubioath-desktop/blob/main/images/touch.svg.
source="https://github.com/maximbaz/yubikey-touch-detector/archive/$pkgver/yubikey-touch-detector-$pkgver.tar.gz
	yubikey-touch-detector.svg
	"
# !check: no tests provided
# net: needed for fetching go dependencies
options="!check net"

export GOCACHE="${GOCACHE:-"$srcdir/go-cache"}"
export GOTMPDIR="${GOTMPDIR:-"$srcdir"}"
export GOMODCACHE="${GOMODCACHE:-"$srcdir/go"}"

prepare() {
	default_prepare
	sed -i 's/GOFLAGS :=/GOFLAGS +=/' Makefile
}

build() {
	make GOFLAGS="$GOFLAGS -tags=netcgo -v"
}

package() {
	make DESTDIR="$pkgdir" install

	# Nothing useful
	rm -rf "$pkgdir"/usr/lib
	rm -rf "$pkgdir"/usr/share

	install -D -m644 "$srcdir"/yubikey-touch-detector.svg -t "$pkgdir"/usr/share/pixmaps/
}

sha512sums="
f9b872e2006978db7908026dd9f79d5b019cba92eb1c50fb5bd4890d5287162b68444c94a6c178528c9b5226e2089e85a9bdf6068a337d5769c2cf3ca8b2ba99  yubikey-touch-detector-1.10.1.tar.gz
4b37793b5ab01391ddc808d8a4cd1650f0fb971e582883f7ef9954d9c72d4f9968f0a32fed311fafaa08c5fc0f1880e25dbf2be698cb312ca8be3f8aac27998b  yubikey-touch-detector.svg
"
